package cn.sundat.utils;

import java.util.UUID;

/**
 * 图片上传工具类
 */
public class UploadUtils {
	
	public static String getUUIDName(String fileName) {
		//取根
		int index = fileName.lastIndexOf(".");
		//截取
		String substring = "";
		if(index!=-1) {
			substring = fileName.substring(index, fileName.length());
		}
		String uuid = UUID.randomUUID().toString().replaceAll("-", "");
		return uuid+substring;
	}
	
	/**
	 * 根据散列码创建唯一的文件夹
	 * @param companyName
	 * @return
	 */
	public static String getCompanyPath(String companyName) {
		return String.valueOf(companyName.hashCode()).trim();
	}
	
	public static void main(String[] args) {
		System.out.println(getUUIDName("lkjkljkjkl"));
	}
}
